dist-packaging: Don't delete 91-ostree.preset, do clean old rpms/sources
authorColin Walters <walters@verbum.org>
Sun, 5 Apr 2015 13:18:42 +0000 (09:18 -0400)
committerColin Walters <walters@verbum.org>
Sun, 5 Apr 2015 13:37:58 +0000 (09:37 -0400)
We have to copy the sources to avoid rpmbuild deleting them.  But on
the other hand there's no reason for old sources to stick around.

packaging/Makefile.dist-packaging

index e1389ebd49fe451f8a84525bf2c56041c853100b..b55211d6cc2312d0a8daa8b48be1af5f26066d3f 100644 (file)
@@ -9,6 +9,7 @@ PACKAGE=ostree
 PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
 
 dist-snapshot:
+       rm -f *.tar.xz
        set -x; \
        echo "PACKAGE=$(PACKAGE)"; \
        TARFILE_TMP=$(PKG_VER).tar.tmp; \
@@ -26,8 +27,14 @@ dist-snapshot:
        xz $(PKG_VER).tar 
 
 srpm: dist-snapshot
-        sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \
-        ./rpmbuild-cwd -bs $(PACKAGE).spec
+       (tmpd=`pwd`/tmp-packaging; rm -rf "$${tmpd}";  mkdir "$${tmpd}"; \
+        sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > "$${tmpd}/$(PACKAGE).spec"; \
+        cp 91-ostree.preset "$${tmpd}"; ln $(PKG_VER).tar.xz "$${tmpd}"; \
+        cd "$${tmpd}" && ../rpmbuild-cwd -bs $(PACKAGE).spec && mv *.src.rpm ..)
 
-rpm: srpm
-       ./rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm
+rpm: dist-snapshot
+       rm -f *.rpm
+       (tmpd=`pwd`/tmp-packaging; rm -rf "$${tmpd}";  mkdir "$${tmpd}"; \
+        sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > "$${tmpd}/$(PACKAGE).spec"; \
+        cp 91-ostree.preset "$${tmpd}"; ln $(PKG_VER).tar.xz "$${tmpd}"; \
+        cd "$${tmpd}" && ../rpmbuild-cwd -bb $(PACKAGE).spec && mv $$(arch)/*.rpm ..)